def calculateScore(playerResult): # 输入参数为列表，表示切分完的玩家结果
    score = 0
    for i in playerResult:
        score += colorScore[i]
    return score

if __name__ == '__main__':
    colorScore = {'A': 1, 'R': 1, 'O': 3, 'G': 3, 'B': 6, 'AO': 5, 'OB': 10, 'BG': 10, 'GR': 5}
    # 蓝色（A）、红色（R）、橘色（O）、绿色（G）、黑色（B）

    player1 = input().split() # 输入3个玩家的结果
    player2 = input().split()
    player3 = input().split()

    # player1 = 'GR A B'.split()
    # player2 = 'OB BG AO O'.split()
    # player3 = 'R G'.split()

    playerScores = [calculateScore(player1), calculateScore(player2), calculateScore(player3)]
    playerScores.sort()
    scoreOutput = str(playerScores[2]) + ' ' + str(playerScores[1]) + ' ' + str(playerScores[0])
    print(scoreOutput)